//
// Windmill adventure object handling
//
// L. Dean Gibson II  2/21/01
//

#ifndef ADV_WINDMILL_H_INCLUDED
#define ADV_WINDMILL_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "material_amount.h"
#include "owned_scriptable_adv_object.h"

class t_adventure_ai;

// -------------------------------------------------------------------
// generator which produces material once per week
// -------------------------------------------------------------------
class t_adv_windmill : public t_owned_scriptable_adv_object
{
public:
	t_adv_windmill(  std::string const& source );
	t_adv_windmill( t_material type );

	virtual void	activate_trigger( t_army* army, t_adv_map_point const& point, 
		                           t_direction direction, t_adventure_frame* frame );
	virtual float	ai_value( t_adventure_ai const& ai, t_creature_array const& army, int move_cost ) const;	

	t_material		get_material() const;
	int				get_production();
	virtual int		get_version() const;
	virtual void	place( t_adventure_map& map, t_adv_map_point const& point );
	virtual void	process_new_day();
	virtual bool	read(  std::streambuf &					stream,
							t_qualified_adv_object_type const &	type,
							int									version );
	virtual bool	read_from_map( std::streambuf& buffer, t_progress_handler* );
	virtual bool	write( std::streambuf & stream ) const;


protected:
	void reset();

private:
	void			randomize_production();

	t_material_amount m_material;
	int				  m_production_time; // 0-7 days.
};

#endif // ADV_WINDMILL_H_INCLUDED
